#include "main.h"
#include "CSurface.h"
#include "SDL/SDL.h"

bool Main::OnInit() {
    if(SDL_Init(SDL_INIT_EVERYTHING) <0 ){
        return false;
    }
    if(TTF_Init() != 0){
        return false;
    }
    
    SDL_WM_SetCaption("Tic Tac Toeoeoe!", NULL);
    
    if((Surf_Display = SDL_SetVideoMode(600,600,32, SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL){
        return false;
    }
    
    if((Surf_Grid = CSurface::OnLoad("img/bkg/grid.bmp")) == NULL) {
        return false;
    }
    
    if((Surf_O = CSurface::OnLoad("img/sprites/o.bmp")) == NULL){
        return false;
    }
    
    if((Surf_X = CSurface::OnLoad("img/sprites/x.bmp")) == NULL){
        return false;
    }
    
    if((Surf_text = CSurface::OnFontLoad("img/fonts/arial.ttf", Players[CurrentPlayer])) == NULL){
        return false;
    }
    
    CSurface::Transparent(Surf_X,255,0,255);
    CSurface::Transparent(Surf_O,255,0,255);
    Reset();
    return true;
}
